package cn.hr.entity;


import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * 专业实体类
 */
@Entity
@Table(name="tb_specialty"
    ,catalog="hrm"
)

public class Specialty  implements java.io.Serializable {


    // Fields    

     /**
	 * 
	 */
	private static final long serialVersionUID = 4638200496040455989L;
	private Integer id;
     private College college;
     private String specialtyName;
     private Set<ClassInfo> classInfos = new HashSet<ClassInfo>(0);


    // Constructors

    /** default constructor */
    public Specialty() {
    }

	/** minimal constructor */
    public Specialty(College college, String specialtyName) {
        this.college = college;
        this.specialtyName = specialtyName;
    }
    
    /** full constructor */
    public Specialty(College college, String specialtyName, Set<ClassInfo> classInfos) {
        this.college = college;
        this.specialtyName = specialtyName;
        this.classInfos = classInfos;
    }

   
    // Property accessors
    @Id @GeneratedValue(strategy=IDENTITY)
    
    @Column(name="id", unique=true, nullable=false)

    public Integer getId() {
        return this.id;
    }
    
    public void setId(Integer id) {
        this.id = id;
    }
	@ManyToOne(fetch=FetchType.LAZY)
        @JoinColumn(name="collegeId", nullable=false)

    public College getCollege() {
        return this.college;
    }
    
    public void setCollege(College college) {
        this.college = college;
    }
    
    @Column(name="specialtyName", nullable=false, length=32)

    public String getSpecialtyName() {
        return this.specialtyName;
    }
    
    public void setSpecialtyName(String specialtyName) {
        this.specialtyName = specialtyName;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="specialty")

    public Set<ClassInfo> getClassInfos() {
        return this.classInfos;
    }
    
    public void setClassInfos(Set<ClassInfo> classInfos) {
        this.classInfos = classInfos;
    }
   








}